<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
	<style type="text/css">
#pagerwrapper {
	padding: 0 15px;
	width: 98%;
}

#pagerwrapper table td {
	padding-right: 10px;
}

#pagerwrapper .pageinput {
	width: 18px;
	_width: 18px
}

#pagerwrapper .page_square {
	width: 15px;
	height: 13px;
	_width: 15px;
	_height: 13px;
	background-color: #FAFDFC;
	border: 1px #F6F4F2 solid;
	padding: 0 3px;
	_padding: 0 3px;
	margin: 0 3px;
	_margin: 0 3px;
}

#pagerwrapper .page_square_bg {
	width: 15px;
	height: 13px;
	_width: 15px;
	_height: 13px;
	background-color: #0468B4;
	border: 1px #F6F4F2 solid;
	padding: 0 3px;
	_padding: 0 3px;
}

#pagerwrapper .page_word {
	width: 50px;
	height: 13px;
	_width: 50px;
	_height: 13px;
	background-color: #FAFDFC;
	border: 1px #F6F4F2 solid;
	padding: 0 3px;
	_padding: 0 3px;
	margin: 0 3px;
	_margin: 0 3px;
}

#pagerwrapper a {
	color: #0089D1
}

.page_sure {
	width: 50px;
	_width: 50px;
	border-left: #CCCCCC 1px solid;
	border-top: #CCCCCC 1px solid;
	border-right: #999999 1px solid;
	border-bottom: #999999 1px solid;
	background-color: #00CCFF;
}
</style>
<div class="art_list">
	<div class="art_list_title">
	</div>
	<div class="art_list_search">
		<form name="prdsearchform" id="prdsearchform"
			onsubmit="javascript:return check_prdsearch_info(this);"
			action="productSearch.action" method="post">
			<input type="text" name="productWhat" id="productWhat" value="">
			<input type="hidden" name="productFun" id="productFun" value="">
			<input type="hidden" name="dateError" id="dateError"
				value="<s:property value="%{getText('Date_Error')}"/>">
			<input type="hidden" name="searchError" id="searchError"
				value="<s:property value="%{getText('Search_Error')}"/>">
			<select id="fun">
				<option value="date">
					<s:property value="%{getText('Date')}" />
				</option>
				<option value="model">
					<s:property value="%{getText('Model')}" />
				</option>
				<option value="name">
					<s:property value="%{getText('Name')}" />
				</option>
				<option value="type">
					<s:property value="%{getText('Type')}" />
				</option>
			</select>
			<input type="submit" name="prdsearch_submit" id="prdsearch_submit"
				value="<s:property value="%{getText('Search')}"/>">
		</form>
		<script type="text/javascript" language="javascript">
		<!--
		function check_prdsearch_info(thisForm)
		{
		if (/^\s*$/.test(thisForm.elements["productWhat"].value))
		{
			alert($("#searchError").val());
			thisForm.elements["productWhat"].focus();
			return false;
		}
		var dateReg=new RegExp("(([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29)");
		var fun=$("#fun").val();
		var value=$("#productWhat").val();
		if(fun=="date"){
			if(!dateReg.test(value)){
				alert($("#dateError").val()+"：YYYY-MM-DD");
				return false;
			}
		}
		$("#productFun").val(fun);
		return true;
		}
		-->
		</script>
		<script language="javascript">
function pageLocation() {
	var p_v = $("#p").val();
	if (p_v == "") {
		alert($("#error1").val());
		return false;
	}
	if (!(p_v.match(/\d/))) {
		alert($("#error2").val());
		return false;
	}
	var zys=$("#zys").val();
	var cid=$("#cid").val();
	if(parseInt(p_v)>parseInt(zys)){
		alert($("#error3").val());
		return false;
	}
	window.location ="?productPage="+p_v+"&productType="+cid;
}
</script>
	</div>
	<div class="prod_list_con">
		<c:choose>
			<c:when test="${empty productList}">
				<s:property value="%{getText('Index_Products_Null')}" />
			</c:when>
			<c:otherwise>
				<c:forEach items="${productList}" var="product">
					<div class="prod_list_list">
						<div class="prod_list_pic">
							<c:forEach var="img" items="${product.images}" varStatus="num">
								<c:if test="${num.index==0}">
									<a
										href="<%=basePath%>productView.action?productId=${product.id }"
										title="${product.name }"> <img name="picautozoom"
											src="${img.path }" border="0"> </a>
								</c:if>
							</c:forEach>
						</div>
						<div class="prod_list_name">
							<a
								href="<%=basePath%>productView.action?productId=${product.id }"
								title="${product.name }">${product.name }</a>
						</div>
						<div class="prod_list_type">
							<s:property value="%{getText('Index_Type')}" />
							:
							<a href="?productType=${product.category.id }">${product.category.name
								}</a>
						</div>
						<div class="prod_list_intr">
							${product.model }
						</div>
					</div>
				</c:forEach>
			</c:otherwise>
		</c:choose>
	</div>
	<img alt="" src="<%=basePath%>share/images/bag_30.jpg">	
	<div id="pagerwrapper">
		<table id="pager" cellspacing="0">
			<tbody>
			<c:if test="${!empty productList}">
				<tr>
					<td colspan="5">
						<a href="?productPage=1&productType=${fenye.cid }" class="page_word"><s:property value="%{getText('Navigation1')}"/></a>&nbsp;&nbsp;
						<a href="?productPage=${fenye.upPage}&productType=${fenye.cid }" class="page_word"><s:property value="%{getText('Up_Page')}"/></a>&nbsp;
						<!-- <a href="1" class="page_square_bg"><font color="white">1</font></a> -->
						<c:forEach var="ye" begin="${fenye.begin}" end="${fenye.end}">
							<c:choose>
								<c:when test="${fenye.ye==0}">
									<c:choose>
										<c:when test="${ye==fenye.ye+1}">
											<a class="page_square_bg"><font color="white">${ye }</font></a>&nbsp;
										</c:when>
										<c:otherwise>
											<a href="?productPage=${ye }&productType=${fenye.cid }" class="page_square">${ye }</a>&nbsp;
										</c:otherwise>
									</c:choose>
								</c:when>
								<c:otherwise>
									<c:choose>
										<c:when test="${ye==fenye.ye}">
											<a class="page_square_bg"><font color="white">${ye }</font></a>&nbsp;
										</c:when>
										<c:otherwise>
											<a href="?productPage=${ye }&productType=${fenye.cid }" class="page_square">${ye }</a>&nbsp;
										</c:otherwise>
									</c:choose>
								</c:otherwise>
							</c:choose>
							
						</c:forEach>
						<c:choose>
								<c:when test="${fenye.nextPage==fenye.zys}">
									<a href="?productPage=${fenye.zys}&productType=${fenye.cid }"
										class="page_word"><s:property
											value="%{getText('Down_Page')}" />
									</a>&nbsp;&nbsp;
						</c:when>
								<c:otherwise>
									<c:choose>
										<c:when test="${fenye.nextPage==1}">
											<a href="?productPage=2&productType=${fenye.cid }"
												class="page_word"><s:property
													value="%{getText('Down_Page')}" />
											</a>&nbsp;&nbsp;
							</c:when>
										<c:otherwise>
											<a
												href="?productPage=${fenye.nextPage}&productType=${fenye.cid }"
												class="page_word"><s:property
													value="%{getText('Down_Page')}" />
											</a>&nbsp;&nbsp;
							</c:otherwise>
									</c:choose>
								</c:otherwise>
							</c:choose>					
						<a href="?productPage=${fenye.zys}&productType=${fenye.cid }" class="page_word"><s:property value="%{getText('Last_Page')}"/></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<s:property value="%{getText('Jump_Page')}"/>：
						<input type="text" name="p" id="p" value="" class="pageinput">
						&nbsp;<s:property value="%{getText('Page')}"/>&nbsp;&nbsp;&nbsp;&nbsp;
						<a href="javascript:pageLocation()" class="page_sure">&nbsp;<s:property value="%{getText('Ok')}"/>&nbsp;</a>
						<input type="hidden" name="zys" id="zys" value="${fenye.zys }">
						<input type="hidden" name="cid" id="cid" value="${fenye.cid }">
						<input type="hidden" name="error1" id="error1" value="<s:property value="%{getText('News_All_Articles_Error1')}"/>">
						<input type="hidden" name="error2" id="error2" value="<s:property value="%{getText('News_All_Articles_Error2')}"/>">
						<input type="hidden" name="error3" id="error3" value="<s:property value="%{getText('News_All_Articles_Error3')}"/>">
					</td>
				</tr>
				</c:if>
			</tbody>
		</table>
	</div>
</div>
<div class="blankbar"></div>